<template>
  <div>
    <van-nav-bar :title="navTitle" fixed />
    <div class="main">
      <keep-alive>
        <router-view></router-view>
      </keep-alive>
    </div>
    <van-tabbar route>
      <van-tabbar-item icon="home-o" to="/home">首页</van-tabbar-item>
      <van-tabbar-item icon="fire-o" to="/comment">评论</van-tabbar-item>
    </van-tabbar>
  </div>
</template>

<script>
export default {
  data () {
    return {
      navTitle: '', // 导航标题
    }
  },
  watch: {
    '$route': {
      immediate: true,
      handler (n) {
        this.navTitle = n.meta.title
      }
    }
  }
};
</script>

<style scoped>
.main {
  padding-top: 1.226667rem;
  padding-bottom: 1.333333rem;
}
.van-tabbar-item {
  color: #fcd8c8;
}
.van-nav-bar,
.van-tabbar,
.van-tabbar-item--active {
  background: rgb(255, 102, 0);
  color: #fff;
}

/deep/ .van-nav-bar__title {
  color: #fff;
}
</style>